#ifndef HTTPD_INCLUDE_XML_H
#define HTTPD_INCLUDE_XML_H

#define XML_OBJECT      (0)
#define XML_ELEMENT     (1 << 0)

struct xml
{
    int type;
    char key[128];
    char value[256];
    struct xml *prev;
    struct xml *child;
    struct xml *next;
};

#define create_xml_root(key, value) create_xml_and_assigment(key, value)

extern struct xml *load_xml(char *xml_data);
extern struct xml *create_xml(void);
extern void destroy_xml(struct xml * x);
extern int print_xml(const struct xml *x, char *xml_data, int size);
extern struct xml *get_first_xml_object(struct xml *x, const char *key);
extern struct xml *get_mode_xml(struct xml *x, const char *mode_name);
extern struct xml *get_xml_by_brothers(struct xml *x, struct xml *b, const char *key);
extern struct xml *create_xml_and_assigment(const char *key, const char *value);
extern struct xml *insert_xml_brother(struct xml *x, struct xml *node);
extern struct xml *insert_xml_child(struct xml *x, struct xml *child);

#endif  /* HTTPD_INCLUDE_XML_H */
